package com.example.shiro.model.sys.service.impl;

import com.example.shiro.model.sys.entity.RoleEntity;
import com.example.shiro.model.sys.mapper.RoleMapper;
import com.example.shiro.model.sys.mapper.UserRoleMapper;
import com.example.shiro.model.sys.service.RoleService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Set;

/**
 * <p>
 * 角色信息表 服务实现类
 * </p>
 *
 * @author jatej
 * @since 2020-04-16
 */
@Service
public class RoleServiceImpl extends ServiceImpl<RoleMapper, RoleEntity> implements RoleService {

    @Autowired
    private UserRoleMapper userRoleMapper;

    /**
     * 通过用户Id获取角色名集合
     * @param userId
     * @return
     */
    @Override
    public Set<String> getRoleListByUserId(Integer userId) {
        return userRoleMapper.getRoleNameById(userId);
    }
}
